<template>
  <view class="page-business">
    <view class="b-w inner">
      <u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm">
        <u-form-item label="是否达成建站共识" prop="isReach" labelWidth="250rpx" borderBottom>
          <u-switch
            v-model="formData.isReach"
            :activeValue="1"
            :inactiveValue="0"
            @change="change"
          ></u-switch>
        </u-form-item>
        <u-form-item
          :label="identifying === 'professional' ? '企业名称' : '专家单位'"
          prop="targetCompany"
          labelWidth="80"
          borderBottom
          ref="item1"
        >
          <u--input
            v-model="formData.targetCompany"
            :placeholder="identifying === 'professional' ? '请输入企业名称' : '请输入专家单位'"
            border="none"
          ></u--input>
        </u-form-item>
        <u-form-item
          :label="identifying === 'professional' ? '企业联系人' : '专家姓名'"
          prop="targetName"
          labelWidth="80"
          borderBottom
          ref="item1"
        >
          <u--input
            v-model="formData.targetName"
            :placeholder="identifying === 'professional' ? '请输入企业联系人' : '请输入专家姓名'"
            border="none"
          ></u--input>
        </u-form-item>
        <u-form-item label="联系方式" labelWidth="80" prop="mobile" ref="item1">
          <u--input
            type="number"
            v-model="formData.mobile"
            placeholder="请输入联系方式"
            border="none"
            maxlength="11"
          ></u--input>
        </u-form-item>
      </u--form>
      <view class="confirm-btn">
        <u-button type="primary" text="提交" @click="sumbitCreate"></u-button>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      formData: {
        isReach: 0,
        targetCompany: '',
        targetName: '',
        mobile: '',
      },
      rules: {
        isReach: {
          type: 'string',
          required: true,
          message: '请选择',
        },
        targetCompany: {
          type: 'string',
          required: true,
          message: '请填写单位名称',
          trigger: ['blur', 'change'],
        },
        targetName: {
          type: 'string',
          required: true,
          message: '请填写姓名',
          trigger: ['blur', 'change'],
        },
        mobile: {
          type: 'string',
          required: true,
          message: '请填写联系方式',
          trigger: ['blur', 'change'],
        },
      },
    }
  },
  methods: {
    sumbitCreate() {
      this.$request('/talentMatchIntention/createIntention', this.formData).then((res) => {
        uni.$u.toast('建站成功')
        setTimeout(() => {
          uni.navigateBack({})
        }, 1500)
      })
    },
  },
}
</script>

<style scoped lang="scss">
.confirm-btn {
  margin-top: 20rpx;
}
.page-business {
  padding: 20rpx;
  .inner {
    border-radius: 10rpx;
    padding: 20rpx;
    .header-my {
      border-bottom: 1rpx solid #c8c7cc;
      padding-bottom: 20rpx;
      .title {
      }
    }
  }
}
</style>
